/*
	Copyright (C) 2009 Salil Bhagurkar
	
	This file is part of ViSE
	
	ViSE is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	ViSE is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.
	
	You should have received a copy of the GNU Lesser General Public License
	along with ViSE.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <shared.h>

/*This file defines a central server/client that interfaces with the user for text data.*/

struct node_fs user = {
	.type = TYPE_FS,
	.name = "user",
	NODE_FS_INIT_INIT,
	NODE_FS_OPS_INIT,
	NODE_FS_LIST_INIT
};

/*Read a message from user*/
int user_msg_read(struct node_fs *this, void *buf, u32 offset, u32 count)
{
	return 0;
}

/*Write a message for user on the console*/
int user_msg_write(struct node_fs *this, void *buf, u32 offset, u32 count)
{
	printkbuf);
	return 0;
}

/*This is used to accept and send messages from and to the console.*/
struct node_fs user_msg = {
	.type = TYPE_FS_BOTH,
	.name = "msg",
	NODE_FS_INIT_INIT,
	.read = user_msg_read,
	.write = user_msg_write,
	.enumerate = dummy,
	.notify = dummy,
	.class = NULL,
	NODE_FS_LIST_INIT
};

/*read and write numbers from user*/
int user_num_read(struct node_fs *this, void *buf, u32 offset, u32 count)
{
	return 0;
}

int user_num_write(struct node_fs *this, void *buf, u32 offset, u32 count)
{
	u32 *num;
	num = (u32 *)buf;
	printk"%d", *num);
	return 0;
}

/*This is used to accept and send numbers from and to the console*/
struct node_fs user_num = {
	.type = TYPE_FS_BOTH,
	.name = "num",
	NODE_FS_INIT_INIT,
	.read = user_num_read,
	.write = user_num_write,
	.enumerate = dummy,
	.notify = dummy,
	.class = NULL,
	NODE_FS_LIST_INIT
};

struct node_fs user_hooks = {
	.type = TYPE_FS,
	.name = "hooks",
	NODE_FS_INIT_INIT,
	NODE_FS_OPS_INIT,
	NODE_FS_LIST_INIT,
};

struct node_fs 

void register_user()
{
	fs_link("/", &user);
	fs_link("/user", &user_msg);
	fs_link("/user", &user_num);
}
